package com.fivefaces.ide.plugins;

import com.fivefaces.ide.plugins.impl.LinuxCommandBuilder;
import com.fivefaces.ide.plugins.impl.MacCommandBuilder;
import com.fivefaces.ide.plugins.impl.WindowsCommandBuilder;

/**
 * User: imran.khan
 * Date: 6/04/11
 * Time: 2:05 PM
 */
public class CommandBuilderFactory {

    public CommandBuilder getInstance() {
        CommandBuilder result;
        String os = System.getProperty("os.name");

        if (os.startsWith("Windows")) {
            result = new WindowsCommandBuilder();
        } else if (os.startsWith("Mac")) {
            result = new MacCommandBuilder();
        } else if (os.startsWith("Linux") || os.toLowerCase().contains("linux")) {
            result = new LinuxCommandBuilder();
        } else {
            throw new UnsupportedOperationException("Operating system - " + os + " not supported.");
        }
        return result;
    }
}
